package cn.kgc.tangcco.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * @author 李昊哲
 * @Description
 * @create 2020/12/25 13:28
 */
@WebFilter(urlPatterns = "*.action")
public class TestFilter implements Filter {
    private static int count;
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("第" +  ++count + "次请求");
        filterChain.doFilter(servletRequest,servletResponse);
    }

    @Override
    public void destroy() {

    }
}
